package com.baizhi.Service.Impl;/**
*@Author：请允悲
*@Slogan：致敬大师，致敬未来的me
*@Package：com.baizhi.Service.Impl
*@Project：springbootjwt
*@name：UserServiceImp
*@Date：2023/9/20  16:32
*@Filename：UserServiceImp
*/
import com.baizhi.Service.UserService;
import com.baizhi.dao.UserDao;
import com.baizhi.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class UserServiceImpI implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public User login(User user) {
        User userdb=userDao.login(user);
        if(userdb!=null)
        {
            Map<String,String> map=new HashMap<>();
            map.put("name",userdb.getUsername());
            return userdb;
        }
        throw  new RuntimeException("登录失败");
    }


}
